package cn.gson.boot.model.pojos;

import javax.persistence.*;
import java.util.List;
import java.util.Objects;

@Entity
@Table(name = "sort_", schema = "boot", catalog = "")
public class Sort {//权限分类表
    private int sortId;//权限分类编号
    private String sortName;//分类名称
    private String sortIcon;//分类图标
    private String sortRank;//分类路径

    private List<Gong> gongnengList;


    @OneToMany(mappedBy = "sort")
    public List<Gong> getGongnengList() {
        return gongnengList;
    }

    public void setGongnengList(List<Gong> gongnengList) {
        this.gongnengList = gongnengList;
    }

    @Id
    @Column(name = "sort_id", nullable = false)
    @GeneratedValue(strategy = GenerationType.IDENTITY,generator = "seq")
    public int getSortId() {
        return sortId;
    }

    public void setSortId(int sortId) {
        this.sortId = sortId;
    }

    @Basic
    @Column(name = "sort_name", nullable = true, length = 200)
    public String getSortName() {
        return sortName;
    }

    public void setSortName(String sortName) {
        this.sortName = sortName;
    }

    @Basic
    @Column(name = "sort_icon", nullable = true, length = 200)
    public String getSortIcon() {
        return sortIcon;
    }

    public void setSortIcon(String sortIcon) {
        this.sortIcon = sortIcon;
    }

    @Basic
    @Column(name = "sort_rank", nullable = true)
    public String getSortRank() {
        return sortRank;
    }

    public void setSortRank(String sortRank) {
        this.sortRank = sortRank;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Sort sort = (Sort) o;
        return sortId == sort.sortId &&
                Objects.equals(sortName, sort.sortName) &&
                Objects.equals(sortIcon, sort.sortIcon) &&
                Objects.equals(sortRank, sort.sortRank);
    }

    @Override
    public int hashCode() {
        return Objects.hash(sortId, sortName, sortIcon, sortRank);
    }
}
